package cn.ilovese.collect.datamapper.task;

import cn.ilovese.collect.po.task.Task;
import cn.ilovese.collect.po.work.Work;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@Mapper
public interface TaskMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Task record);

    int insertSelective(Task record);

    Task selectByPrimaryKey(Integer id);

    Task selectByTaskName(String taskname);

    int updateByPrimaryKeySelective(Task record);

    int updateByPrimaryKey(Task record);

    List<Task> selectAll();

    List<Task> selectValidTasks(Timestamp curr);

    List<Task> selectTaskNeedsWorker();

    List<Task> selectProducedTask(@Param(value = "userId") Integer uid, @Param(value = "endTime") Timestamp curr);

    //完成任务有两种情况，一种是已经截止了，另一种是报告收齐了
    List<Task> selectCompletedTask(@Param(value = "userId") Integer uid, @Param(value = "endTime") Timestamp curr);

    List<Task> selectWorkingTask(Integer uid);

    List<Task> selectFinishedTask(Integer uid);

    void decreaseNeedNum(Integer id);
}